]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
gdm: Expose the source serviceName for messages and verification failures
authorMarco Trevisan (Treviño) <mail@3v1n0.net>
Mon, 1 Feb 2021 18:36:49 +0000 (19:36 +0100)
committerRay Strode <halfline@gmail.com>
Mon, 15 Feb 2021 16:58:50 +0000 (16:58 +0000)
By giving to the AuthPrompt information regarding the source service
name (and so the ability to know whether it's a foreground service) can
give it the ability to behave differently.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1652>

js/gdm/authPrompt.js
js/gdm/util.js

index feab52e89244abcb7f7185b761f3c123f594d6d5..4aba39f36de4858fc2f6b21f6e81f622a5f602ed 100644 (file)
@@ -273,12 +273,12 @@ var AuthPrompt = GObject.registerClass({
             this.reset();
     }
 
-    _onShowMessage(userVerifier, message, type) {
-        this.setMessage(message, type);
+    _onShowMessage(_userVerifier, serviceName, message, type) {
+        this.setMessage(serviceName, message, type);
         this.emit('prompted');
     }
 
-    _onVerificationFailed(userVerifier, canRetry) {
+    _onVerificationFailed(userVerifier, serviceName, canRetry) {
         this._queryingService = null;
         this.clear();
 
@@ -410,7 +410,7 @@ var AuthPrompt = GObject.registerClass({
         });
     }
 
-    setMessage(message, type) {
+    setMessage(serviceName, message, type) {
         if (type == GdmUtil.MessageType.ERROR)
             this._message.add_style_class_name('login-dialog-message-warning');
         else
index 369bf89f1f230097fc9c7bfe08c7d3b39479604e..f6a980a2ae16309456437bf5831b09f2df8d93f3 100644 (file)
@@ -296,7 +296,7 @@ var ShellUserVerifier = class {
 
         let message = this._messageQueue.shift();
 
-        this.emit('show-message', message.text, message.type);
+        this.emit('show-message', message.serviceName, message.text, message.type);
 
         this._messageQueueTimeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT,
                                                        message.interval,
@@ -308,11 +308,11 @@ var ShellUserVerifier = class {
         GLib.Source.set_name_by_id(this._messageQueueTimeoutId, '[gnome-shell] this._queueMessageTimeout');
     }
 
-    _queueMessage(message, messageType) {
+    _queueMessage(serviceName, message, messageType) {
         let interval = this._getIntervalForMessage(message);
 
         this.hasPendingMessages = true;
-        this._messageQueue.push({ text: message, type: messageType, interval });
+        this._messageQueue.push({ serviceName, text: message, type: messageType, interval });
         this._queueMessageTimeout();
     }
 
@@ -323,7 +323,7 @@ var ShellUserVerifier = class {
             GLib.source_remove(this._messageQueueTimeoutId);
             this._messageQueueTimeoutId = 0;
         }
-        this.emit('show-message', null, MessageType.NONE);
+        this.emit('show-message', null, null, MessageType.NONE);
     }
 
     _checkForFingerprintReader() {
@@ -383,7 +383,7 @@ var ShellUserVerifier = class {
         logError(error, where);
         this._hold.release();
 
-        this._queueMessage(_("Authentication error"), MessageType.ERROR);
+        this._queueMessage(serviceName, _('Authentication error'), MessageType.ERROR);
         this._failCounter++;
         this._verificationFailed(serviceName, false);
     }
@@ -532,7 +532,7 @@ var ShellUserVerifier = class {
 
     _onInfo(client, serviceName, info) {
         if (this.serviceIsForeground(serviceName)) {
-            this._queueMessage(info, MessageType.INFO);
+            this._queueMessage(serviceName, info, MessageType.INFO);
         } else if (this.serviceIsFingerprint(serviceName)) {
             // We don't show fingerprint messages directly since it's
             // not the main auth service. Instead we use the messages
@@ -540,11 +540,13 @@ var ShellUserVerifier = class {
             if (this._fingerprintReaderType === FingerprintReaderType.SWIPE) {
                 // Translators: this message is shown below the password entry field
                 // to indicate the user can swipe their finger on the fingerprint reader
-                this._queueMessage(_('(or swipe finger across reader)'), MessageType.HINT);
+                this._queueMessage(serviceName, _('(or swipe finger across reader)'),
+                    MessageType.HINT);
             } else {
                 // Translators: this message is shown below the password entry field
                 // to indicate the user can place their finger on the fingerprint reader instead
-                this._queueMessage(_('(or place finger on reader)'), MessageType.HINT);
+                this._queueMessage(serviceName, _('(or place finger on reader)'),
+                    MessageType.HINT);
             }
         }
     }
@@ -555,7 +557,7 @@ var ShellUserVerifier = class {
         if (!this.serviceIsForeground(serviceName) && !isFingerprint)
             return;
 
-        this._queueMessage(problem, MessageType.ERROR);
+        this._queueMessage(serviceName, problem, MessageType.ERROR);
         if (isFingerprint) {
             this._failCounter++;
 
@@ -650,7 +652,7 @@ var ShellUserVerifier = class {
             }
         }
 
-        this.emit('verification-failed', canRetry);
+        this.emit('verification-failed', serviceName, canRetry);
     }
 
     _onConversationStopped(client, serviceName) {